package lab02.test36;

/**
 * Created by 14394 on 2017/11/13.
 */
public class Test {
    public static void main(String[] args) {
        double[] du1 = {90, 95, 100};
        double[] du2 = {80, 85, 90};
        double[] du3 = {75, 82, 87};
        double[] dp1 = {82, 85, 88};
        double[] dp2 = {80, 82, 84};
        Undergraduate u1 = new Undergraduate("张三", du1);
        Undergraduate u2 = new Undergraduate("李四", du2);
        Undergraduate u3 = new Undergraduate("赵六", du3);
        Postgraduate p1 = new Postgraduate("王五", dp1);
        Postgraduate p2 = new Postgraduate("王五", dp2);

        System.out.println("姓名    类型    成绩   ");
        System.out.println(u1.name + "    " + new Test().turnType(u1.type) + "   "+new Test().getStudentGrade(u1.type,u1.getAverygeGrades()));
        System.out.println(u2.name + "    " + new Test().turnType(u2.type) + "   "+new Test().getStudentGrade(u2.type,u2.getAverygeGrades()));
        System.out.println(p1.name + "    " + new Test().turnType(p1.type) + "   "+new Test().getStudentGrade(p1.type,p1.getAverygeGrades()));
        System.out.println(u3.name + "    " + new Test().turnType(u3.type) + "   "+new Test().getStudentGrade(u3.type,u3.getAverygeGrades()));
        System.out.println(p2.name + "    " + new Test().turnType(p2.type) + "   "+new Test().getStudentGrade(p2.type,p2.getAverygeGrades()));
    }

    public String turnType(int type) {
        if (type == 1) {
            return "本科生";
        } else {
            return "研究生";
        }
    }

    public String getStudentGrade(int type, double averageGrades) {
        if (type == 1) {
            if (averageGrades >= 80) {
                return "优秀";
            }else if (averageGrades>=70){
                return "良好";
            }else if (averageGrades>=60){
                return "一般";
            }else if (averageGrades>=50){
                return "及格";
            }else {
                return "不及格";
            }
        } else {
            if (averageGrades >= 90) {
                return "优秀";
            }else if (averageGrades>=80){
                return "良好";
            }else if (averageGrades>=70){
                return "一般";
            }else if (averageGrades>=60){
                return "及格";
            }else {
                return "不及格";
            }
        }
    }


}
